load("//devtools/tools:defaults.bzl", "esbuild", "http_server", "ng_project")

package(default_visibility = ["//:__subpackages__"])

ng_project(
    name = "src",
    srcs = ["main.ts"],
    deps = [
        "//:node_modules/@angular/common",
        "//:node_modules/@angular/core",
        "//:node_modules/@angular/platform-browser",
        "//:node_modules/rxjs",
        "//devtools/projects/demo-no-zone/src/app",
    ],
)

esbuild(
    name = "bundle",
    srcs = [
        "//devtools/tools/esbuild:esbuild_base",
        "//devtools/tools/esbuild:esbuild_config_esm",
    ],
    config = "//devtools/tools/esbuild:esbuild-esm.config.mjs",
    entry_points = [":main.ts"],
    platform = "browser",
    splitting = False,
    target = "es2016",
    deps = [":src"],
)

exports_files([
    "index.html",
    "styles.css",
])

filegroup(
    name = "dev_app_static_files",
    srcs = [
        ":index.html",
        ":styles.css",
    ],
)

http_server(
    name = "devserver",
    srcs = [":dev_app_static_files"],
    tags = ["manual"],
    deps = [
        ":bundle",
    ],
)
